FUNCTION DAC_GetBitOfDword :BOOL
TITLE = 'DAC_GetBitOfDword'
//
// This functionblock extract a single bit of a dword
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : 'xofdw'
KNOW_HOW_PROTECT

VAR_INPUT
    dwInput:                    DWORD;                               // Inputdword
    byBitNr:                    BYTE;                               // Bitnumber (Range 0 - 31)
END_VAR

VAR
END_VAR

BEGIN
DAC_GetBitOfDword := false;
IF (BYTE_TO_INT(byBitNr) >= 0) AND (BYTE_TO_INT(byBitNr) < 32) THEN
    DAC_GetBitOfDword := DWORD_TO_DINT((SHR(IN:=dwInput,N:=BYTE_TO_INT(byBitNr)) AND 16#00000001)) > 0;    
END_IF;

END_FUNCTION

